cp -R $1 $2
cd $2
for i in $1*; do mv $i ${i/$1/$2}; done | xargs
perl -pi -e 's/'"$1"'/'"$2"'/g;' $(find .) 
